﻿@model PhoneStoreWeb.Models.Product

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section LeftMenu
{
    <ul>
        @Html.Action(actionName: "ManufacturerMenu", controllerName: "Product", routeValues: new { category = (string)ViewBag.Category })
    </ul>
}

@section RightMenu
{
    <div class="details">
        <img src="~/Images/Icons/ProductFeatures.png" alt="ProductFeatures.png" width="40" height="30" />
        <p>Chi tiết sản phẩm</p>
    </div>
}

<script src="~/Scripts/jquery.zoom.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.zoom').zoom();
    });
</script>

<div class="details">
    @if (Model.Category.Name.Equals("ĐIỆN THOẠI DI ĐỘNG")) // Smartphone
    {
        <div class='zoom'>
		    <img src="@Url.Content("~/Images/Products/Smartphones/" + Model.ProductImage)" alt="@Model.ProductImage" width="150" height="200" />
	    </div>
    }
    else if (Model.Category.Name.Equals("MÁY TÍNH BẢNG")) // Tablet
    {
        <div class='zoom'>
		    <img src="@Url.Content("~/Images/Products/Tablets/" + Model.ProductImage)" alt="@Model.ProductImage" width="150" height="200" />
	    </div>
    }
    <!-- Name -->
    <div><span class="details-label">Tên:</span><span class="name-price">@Html.Encode(Model.Name)</span></div>
    <!-- Manufacturer -->
    <div><span class="details-label">Nhà sản xuất:</span>@Html.Encode(Model.Manufacturer.Name)</div>
    <!-- WarrantyTime -->
    <div><span class="details-label">Thời gian bảo hành:</span>@Html.Encode(Model.WarrantyTime) Tháng</div>
    <hr />
    @if (!Model.IsPromotional)
    {
        <div><span class="details-label">Giá:</span><span class="name-price">@Html.Encode(String.Format("{0:C0}", Model.RetailPrice))</span></div>
    }
    else
    {
        <div><span class="details-label">Giá cả:</span><span class="old-price">@Html.Encode(String.Format("{0:C0}", Model.RetailPrice))</span></div>
        int newPrice = (int)Model.RetailPrice * (100 - (int)Model.Promotions.Last(p => p.ProductID == Model.ProductID).Percentage) / 100;
        <div><span class="details-label">Giá khuyến mãi:</span><span class="name-price">@Html.Encode(String.Format("{0:C0}", newPrice))</span></div>
    }
    @Html.ActionLink("Mua hàng", "AddToCart", "ShoppingCart", new { id = Model.ProductID}, null)
    <div class="zoom-icon">
        <img src="~/Images/Icons/Zoom.png" alt="Zoom.png" width="30" height="15" />
    </div>
    <table border="1">
        <!-- GENERAL INFORMATION -->
        @if (Model.PhoneTablet.Phone_General != null)
        {
            <tr>
                <th class="title" rowspan="6">THÔNG TIN CHUNG</th>
                <th>Mạng 2G</th>
                <td>@Model.PhoneTablet.Phone_General.TwoGNetwork</td>
            </tr>
            <tr>
                <th>Mạng 3G</th>
                <td>@Model.PhoneTablet.Phone_General.ThreeGNetwork</td>
            </tr>
            <tr>
                <th>Mạng 4G</th>
                <td>@Model.PhoneTablet.Phone_General.FourGNetwork</td>
            </tr>
            <tr>
                <th>SIM</th>
                <td>@Model.PhoneTablet.Phone_General.Sim</td>
            </tr>
            <tr>
                <th>Giới thiệu</th>
                <td>@Model.PhoneTablet.Phone_General.Announced</td>
            </tr>
            <tr>
                <th>Trạng thái</th>
                <td>@Model.PhoneTablet.Phone_General.Status</td>
            </tr>
        }
        <!-- BODY INFORMATION -->
        @if (Model.PhoneTablet.Phone_Body != null)
        {
            <tr>
                <th class="title" rowspan="2">THÂN MÁY</th>
                <th>Kích thước</th>
                <td>@Model.PhoneTablet.Phone_Body.Dimensions</td>
            </tr>
            <tr>
                <th>Trọng lượng (g)</th>
                <td>@Model.PhoneTablet.Phone_Body.Weight</td>
            </tr>
        }
        <!-- DISPLAY INFORMATION -->
        @if (Model.PhoneTablet.Phone_Display != null)
        {
            <tr>
                <th class="title" rowspan="4">MÀN HÌNH</th>
                <th>Loại</th>
                <td>@Model.PhoneTablet.Phone_Display.Type</td>
            </tr>
            <tr>
                <th>Kích thước</th>
                <td>@Model.PhoneTablet.Phone_Display.Size</td>
            </tr>
            <tr>
                <th>Cảm ứng đa điểm</th>
                <td>@Model.PhoneTablet.Phone_Display.Multitouch</td>
            </tr>
            <tr>
                <th>Chế độ bảo vệ</th>
                <td>@Model.PhoneTablet.Phone_Display.Protection</td>
            </tr>
        }
        <!-- SOUND INFORMATION -->
        @if (Model.PhoneTablet.Phone_Sound != null)
        {
            <tr>
                <th class="title" rowspan="3">LOA</th>
                <th>Loại cảnh báo</th>
                <td>@Model.PhoneTablet.Phone_Sound.AlertTypes</td>
            </tr>
            <tr>
                <th>Loa ngoài</th>
                <td>@Model.PhoneTablet.Phone_Sound.LoudSpeaker</td>
            </tr>
            <tr>
                <th>Jack cắm</th>
                <td>@Model.PhoneTablet.Phone_Sound.ThreePointFiveMMJack</td>
            </tr>
        }
        <!-- MEMORY INFORMATION -->
        @if (Model.PhoneTablet.Phone_Memory != null)
        {
            <tr>
                <th class="title" rowspan="2">BỘ NHỚ</th>
                <th>Khe cắm</th>
                <td>@Model.PhoneTablet.Phone_Memory.CardSlot</td>
            </tr>
            <tr>
                <th>Bộ nhớ trong</th>
                <td>@Model.PhoneTablet.Phone_Memory.Internal</td>
            </tr>
        }
        <!-- DATA INFORMATION -->
        @if (Model.PhoneTablet.Phone_Data != null)
        {
            <tr>
                <th class="title" rowspan="8">DỮ LIỆU</th>
                <th>GPRS</th>
                <td>@Model.PhoneTablet.Phone_Data.GPRS</td>
            </tr>
            <tr>
                <th>EDGE</th>
                <td>@Model.PhoneTablet.Phone_Data.EDGE</td>
            </tr>
            <tr>
                <th>Tốc độ mạng</th>
                <td>@Model.PhoneTablet.Phone_Data.Speed</td>
            </tr>
            <tr>
                <th>Wifi</th>
                <td>@Model.PhoneTablet.Phone_Data.WLAN</td>
            </tr>
            <tr>
                <th>Bluetooth</th>
                <td>@Model.PhoneTablet.Phone_Data.Bluetooth</td>
            </tr>
            <tr>
                <th>NFC</th>
                <td>@Model.PhoneTablet.Phone_Data.NFC</td>
            </tr>
            <tr>
                <th>Hồng ngoại</th>
                <td>@Model.PhoneTablet.Phone_Data.InfraredPort</td>
            </tr>
            <tr>
                <th>USB</th>
                <td>@Model.PhoneTablet.Phone_Data.USB</td>
            </tr>
        }
        <!-- CAMERA INFORMATION -->
        @if (Model.PhoneTablet.Phone_Camera != null)
        {
            <tr>
                <th class="title" rowspan="4">MÁY ẢNH</th>
                <th>Camera chính</th>
                <td>@Model.PhoneTablet.Phone_Camera.PrimaryCamera</td>
            </tr>
            <tr>
                <th>Đặc tính</th>
                <td>@Model.PhoneTablet.Phone_Camera.Features</td>
            </tr>
            <tr>
                <th>Video</th>
                <td>@Model.PhoneTablet.Phone_Camera.Video</td>
            </tr>
            <tr>
                <th>Camera phụ</th>
                <td>@Model.PhoneTablet.Phone_Camera.SecondaryCamera</td>
            </tr>
        }
        <!-- FEATURES INFORMATION -->
        @if (Model.PhoneTablet.Phone_Features != null)
        {
            <tr>
                <th class="title" rowspan="12">ĐẶC TÍNH</th>
                <th>Hệ điều hành</th>
                <td>@Model.PhoneTablet.Phone_Features.OS</td>
            </tr>
            <tr>
                <th>Chipset</th>
                <td>@Model.PhoneTablet.Phone_Features.Chipset</td>
            </tr>
            <tr>
                <th>CPU</th>
                <td>@Model.PhoneTablet.Phone_Features.CPU</td>
            </tr>
            <tr>
                <th>GPU</th>
                <td>@Model.PhoneTablet.Phone_Features.GPU</td>
            </tr>
            <tr>
                <th>Cảm biến</th>
                <td>@Model.PhoneTablet.Phone_Features.Sensors</td>
            </tr>
            <tr>
                <th>Tin nhắn</th>
                <td>@Model.PhoneTablet.Phone_Features.Messaging</td>
            </tr>
            <tr>
                <th>Trình duyệt</th>
                <td>@Model.PhoneTablet.Phone_Features.Browser</td>
            </tr>
            <tr>
                <th>FM Radio</th>
                <td>@Model.PhoneTablet.Phone_Features.Radio</td>
            </tr>
            <tr>
                <th>GPS</th>
                <td>@Model.PhoneTablet.Phone_Features.GPS</td>
            </tr>
            <tr>
                <th>Java</th>
                <td>@Model.PhoneTablet.Phone_Features.Java</td>
            </tr>
            <tr>
                <th>Màu sắc</th>
                <td>@Model.PhoneTablet.Phone_Features.Colors</td>
            </tr>
            <tr>
                <th>Các đặc tính khác</th>
                <td>@Model.PhoneTablet.Phone_Features.Others</td>
            </tr>
        }
        <!-- BATTERY INFORMATION -->
        @if (Model.PhoneTablet.Phone_Battery != null)
        {
            <tr>
                <th class="title" rowspan="4">NGUỒN</th>
                <th>Dung lượng pin</th>
                <td>@Model.PhoneTablet.Phone_Battery.Model</td>
            </tr>
            <tr>
                <th>Thời gian chờ</th>
                <td>@Model.PhoneTablet.Phone_Battery.StandBy</td>
            </tr>
            <tr>
                <th>Thời gian đàm thoại</th>
                <td>@Model.PhoneTablet.Phone_Battery.TalkTime</td>
            </tr>
            <tr>
                <th>Thời gian chơi nhạc</th>
                <td>@Model.PhoneTablet.Phone_Battery.MusicPlay</td>
            </tr>
        }
        <!-- MISC INFORMATION -->
        @if (Model.PhoneTablet.Phone_Misc != null)
        {
            <tr>
                <th class="title" rowspan="3">LINH TINH</th>
                <th>SAR US</th>
                <td>@Model.PhoneTablet.Phone_Misc.SAR_US</td>
            </tr>
            <tr>
                <th>SAR EU</th>
                <td>@Model.PhoneTablet.Phone_Misc.SAR_EU</td>
            </tr>
            <tr>
                <th>Nhóm giá</th>
                <td>@Model.PhoneTablet.Phone_Misc.PriceGroup</td>
            </tr>
        }
        <!-- TESTS INFORMATION -->
        @if (Model.PhoneTablet.Phone_Tests != null)
        {
            <tr>
                <th class="title" rowspan="4">THỬ NGHIỆM</th>
                <th>Màn hình</th>
                <td>@Model.PhoneTablet.Phone_Tests.Display</td>
            </tr>
            <tr>
                <th>Loa ngoài</th>
                <td>@Model.PhoneTablet.Phone_Tests.LoudSpeaker</td>
            </tr>
            <tr>
                <th>Chất lượng audio</th>
                <td>@Model.PhoneTablet.Phone_Tests.AudioQuality</td>
            </tr>
            <tr>
                <th>Máy ảnh</th>
                <td>@Model.PhoneTablet.Phone_Tests.Camera</td>
            </tr>
        }
    </table>
</div>